/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * <p>Project: RabbitMQ - Consumer</p>
 * <p>Powered by yzc On 2023-12-25 10:48:37</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@Component
public class Consumer {

    @RabbitListener(queues = {"queue-manual"})
     public void handler(Message message,Channel channel) throws IOException {
        System.out.println("消费:"+new String(message.getBody()));
        //手动应答 告诉mq服务器我已经消费了
       // channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
